<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Hammerspoon docs: EjectMenu</title>
    <style type="text/css">
      a { text-decoration: none; }
      a:hover { text-decoration: underline; }
      th { background-color: #DDDDDD; vertical-align: top; padding: 3px; }
      td { width: 100%; background-color: #EEEEEE; vertical-align: top; padding: 3px; }
      table { width: 100% ; border: 1px solid #0; text-align: left; }
      section > table table td { width: 0; }
    </style>
    <link rel="stylesheet" href="docs.css" type="text/css" media="screen" />
  </head>
  <body>
    <header>
      <h1><a href="./index.html">docs</a> &raquo; EjectMenu</h1>
      <p>A much-needed eject menu for your Mac menu bar. Allows ejecting
individual or all non-internal disks. Ejection can also be
triggered on sleep, on lid close, or using a hotkey.
Using the Command key modifier causes the menu to open
the given volume in the Finder instead of ejecting it.</p>
<p>Download: <a href="https://github.com/Hammerspoon/Spoons/raw/master/Spoons/EjectMenu.spoon.zip">https://github.com/Hammerspoon/Spoons/raw/master/Spoons/EjectMenu.spoon.zip</a></p>

      </header>
      <h3>API Overview</h3>
      <ul>
        <li>Variables - Configurable values</li>
          <ul>
            <li><a href="#eject_on_lid_close">eject_on_lid_close</a></li>
            <li><a href="#eject_on_sleep">eject_on_sleep</a></li>
            <li><a href="#logger">logger</a></li>
            <li><a href="#never_eject">never_eject</a></li>
            <li><a href="#notify">notify</a></li>
            <li><a href="#other_eject_events">other_eject_events</a></li>
            <li><a href="#show_in_menubar">show_in_menubar</a></li>
          </ul>
        <li>Methods - API calls which can only be made on an object returned by a constructor</li>
          <ul>
            <li><a href="#bindHotkeys">bindHotkeys</a></li>
            <li><a href="#ejectVolumes">ejectVolumes</a></li>
            <li><a href="#shouldEject">shouldEject</a></li>
            <li><a href="#start">start</a></li>
            <li><a href="#stop">stop</a></li>
            <li><a href="#volumesToEject">volumesToEject</a></li>
          </ul>
      </ul>
      <h3>API Documentation</h3>
        <h4 class="documentation-section">Variables</h4>
          <section id="eject_on_lid_close">
            <a name="//apple_ref/cpp/Variable/eject_on_lid_close" class="dashAnchor"></a>
            <h5><a href="#eject_on_lid_close">eject_on_lid_close</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu.eject_on_lid_close</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Boolean, whether to eject volumes when the laptop lid is closed with an external display connected.</p>
</td>
              </tr>
              <tr>
                  <th>Notes</th>
                  <td><ul>
<li>There is no &quot;lid close&quot; event, so we detect when the internal display gets disabled.</li>
<li>This method is somewhat unreliable (e.g. it also triggers when the internal display goes to sleep due to inactivity), so its default value is <code>false</code></li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L50">Source/EjectMenu.spoon/init.lua line 50</a></td>
              </tr>
            </table>
          </section>
          <section id="eject_on_sleep">
            <a name="//apple_ref/cpp/Variable/eject_on_sleep" class="dashAnchor"></a>
            <h5><a href="#eject_on_sleep">eject_on_sleep</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu.eject_on_sleep</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Boolean, whether to eject volumes before the system goes to sleep. Default value: true</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L45">Source/EjectMenu.spoon/init.lua line 45</a></td>
              </tr>
            </table>
          </section>
          <section id="logger">
            <a name="//apple_ref/cpp/Variable/logger" class="dashAnchor"></a>
            <h5><a href="#logger">logger</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu.logger</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L30">Source/EjectMenu.spoon/init.lua line 30</a></td>
              </tr>
            </table>
          </section>
          <section id="never_eject">
            <a name="//apple_ref/cpp/Variable/never_eject" class="dashAnchor"></a>
            <h5><a href="#never_eject">never_eject</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu.never_eject</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>List containing volume paths that should never be ejected. Default value: empty list</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L35">Source/EjectMenu.spoon/init.lua line 35</a></td>
              </tr>
            </table>
          </section>
          <section id="notify">
            <a name="//apple_ref/cpp/Variable/notify" class="dashAnchor"></a>
            <h5><a href="#notify">notify</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu.notify</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Boolean, whether to produce a notification about the volumes that get ejected. Default value: <code>false</code></p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L40">Source/EjectMenu.spoon/init.lua line 40</a></td>
              </tr>
            </table>
          </section>
          <section id="other_eject_events">
            <a name="//apple_ref/cpp/Variable/other_eject_events" class="dashAnchor"></a>
            <h5><a href="#other_eject_events">other_eject_events</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu.other_eject_events</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>List of additional system events on which the volumes should be ejected.</p>
</td>
              </tr>
              <tr>
                  <th>Notes</th>
                  <td><ul>
<li>The values must be <a href="%60hs.caffeinate.watcher%60">http://www.hammerspoon.org/docs/hs.caffeinate.watcher.html</a> constant values. Default value: empty list</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L64">Source/EjectMenu.spoon/init.lua line 64</a></td>
              </tr>
            </table>
          </section>
          <section id="show_in_menubar">
            <a name="//apple_ref/cpp/Variable/show_in_menubar" class="dashAnchor"></a>
            <h5><a href="#show_in_menubar">show_in_menubar</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu.show_in_menubar</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Boolean, whether to show a menubar button to eject all drives. Default value: true</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L59">Source/EjectMenu.spoon/init.lua line 59</a></td>
              </tr>
            </table>
          </section>
        <h4 class="documentation-section">Methods</h4>
          <section id="bindHotkeys">
            <a name="//apple_ref/cpp/Method/bindHotkeys" class="dashAnchor"></a>
            <h5><a href="#bindHotkeys">bindHotkeys</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu:bindHotkeys(mapping, ejectAll)</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Binds hotkeys for EjectMenu</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>mapping - A table containing hotkey objifier/key details for the following items:</li>
<li>ejectAll - eject all volumes.</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td></td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L217">Source/EjectMenu.spoon/init.lua line 217</a></td>
              </tr>
            </table>
          </section>
          <section id="ejectVolumes">
            <a name="//apple_ref/cpp/Method/ejectVolumes" class="dashAnchor"></a>
            <h5><a href="#ejectVolumes">ejectVolumes</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu:ejectVolumes()</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Eject all volumes</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>persistent_notifs: a boolean indicating whether notifications (if shown) should be persistent.</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td></td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L125">Source/EjectMenu.spoon/init.lua line 125</a></td>
              </tr>
            </table>
          </section>
          <section id="shouldEject">
            <a name="//apple_ref/cpp/Method/shouldEject" class="dashAnchor"></a>
            <h5><a href="#shouldEject">shouldEject</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu:shouldEject(path, info)</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Determine if a volume should be ejected.</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>path - the mount path of the volume.</li>
<li>info - a table containing a data structure as returned by <code>hs.fs.volume.allVolumes()</code>.</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>A boolean indicating whether the volume should be ejected.</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L72">Source/EjectMenu.spoon/init.lua line 72</a></td>
              </tr>
            </table>
          </section>
          <section id="start">
            <a name="//apple_ref/cpp/Method/start" class="dashAnchor"></a>
            <h5><a href="#start">start</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu:start()</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Start the watchers for power events and screen changes, to trigger volume ejection.</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>None</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td></td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L243">Source/EjectMenu.spoon/init.lua line 243</a></td>
              </tr>
            </table>
          </section>
          <section id="stop">
            <a name="//apple_ref/cpp/Method/stop" class="dashAnchor"></a>
            <h5><a href="#stop">stop</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu:stop()</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Stop the watchers</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>None</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td></td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L285">Source/EjectMenu.spoon/init.lua line 285</a></td>
              </tr>
            </table>
          </section>
          <section id="volumesToEject">
            <a name="//apple_ref/cpp/Method/volumesToEject" class="dashAnchor"></a>
            <h5><a href="#volumesToEject">volumesToEject</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>EjectMenu:volumesToEject()</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Return table of volumes to be ejected when &quot;Eject All&quot; is invoked.</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>None</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>A table in the same format as returned by <code>hs.fs.volume.allVolumes()</code> but containing only those volumes for which <code>EjectMenu:shouldEject()</code> returns <code>true</code>.</li>
<li>An integer indicating how many volumes are in the table.</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/EjectMenu.spoon/init.lua#L87">Source/EjectMenu.spoon/init.lua line 87</a></td>
              </tr>
            </table>
          </section>
  </body>
</html>